package c.e.a.b.f.b;

import android.content.SharedPreferences.Editor;
import android.content.pm.ApplicationInfo;
import c.e.a.b.b.j.f;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class t3 implements Runnable {
    public final /* synthetic */ int a;
    public final /* synthetic */ String b;
    public final /* synthetic */ Object c;
    public final /* synthetic */ Object d;
    public final /* synthetic */ Object e;
    public final /* synthetic */ q3 f;

    public t3(q3 q3Var, int i, String str, Object obj, Object obj2, Object obj3) {
        this.f = q3Var;
        this.a = i;
        this.b = str;
        this.c = obj;
        this.d = obj2;
        this.e = obj3;
    }

    public final void run() {
        d4 o = this.f.a.o();
        if (o.n()) {
            String str;
            q3 q3Var = this.f;
            boolean z = true;
            if (q3Var.c == 0) {
                c cVar = q3Var.a.g;
                if (cVar.d == null) {
                    synchronized (cVar) {
                        if (cVar.d == null) {
                            ApplicationInfo applicationInfo = cVar.a.a.getApplicationInfo();
                            String a = f.a();
                            if (applicationInfo != null) {
                                str = applicationInfo.processName;
                                boolean z2 = str != null && str.equals(a);
                                cVar.d = Boolean.valueOf(z2);
                            }
                            if (cVar.d == null) {
                                cVar.d = Boolean.TRUE;
                                cVar.d().f.a("My process not in the list of running processes");
                            }
                        }
                    }
                }
                if (cVar.d.booleanValue()) {
                    this.f.c = 'C';
                } else {
                    this.f.c = 'c';
                }
            }
            q3Var = this.f;
            if (q3Var.d < 0) {
                q3Var.d = 33025;
            }
            char charAt = "01VDIWEA?".charAt(this.a);
            q3 q3Var2 = this.f;
            char c = q3Var2.c;
            long j = q3Var2.d;
            str = q3.u(true, this.b, this.c, this.d, this.e);
            StringBuilder stringBuilder = new StringBuilder(String.valueOf(str).length() + 24);
            stringBuilder.append("2");
            stringBuilder.append(charAt);
            stringBuilder.append(c);
            stringBuilder.append(j);
            stringBuilder.append(":");
            stringBuilder.append(str);
            String stringBuilder2 = stringBuilder.toString();
            if (stringBuilder2.length() > 1024) {
                stringBuilder2 = this.b.substring(0, 1024);
            }
            k4 k4Var = o.d;
            k4Var.e.g();
            if (k4Var.e.w().getLong(k4Var.a, 0) == 0) {
                k4Var.a();
            }
            if (stringBuilder2 == null) {
                stringBuilder2 = "";
            }
            long j2 = k4Var.e.w().getLong(k4Var.b, 0);
            Editor edit;
            if (j2 <= 0) {
                edit = k4Var.e.w().edit();
                edit.putString(k4Var.c, stringBuilder2);
                edit.putLong(k4Var.b, 1);
                edit.apply();
            } else {
                j2++;
                if ((k4Var.e.k().v0().nextLong() & Long.MAX_VALUE) >= Long.MAX_VALUE / j2) {
                    z = false;
                }
                edit = k4Var.e.w().edit();
                if (z) {
                    edit.putString(k4Var.c, stringBuilder2);
                }
                edit.putLong(k4Var.b, j2);
                edit.apply();
            }
            return;
        }
        this.f.v(6, "Persisted config not initialized. Not logging error/warn");
    }
}
